<template>
	<view v-if="is_init">
		<uni-popup-input @close="on_close">
			<view class="banmi_flex a-c  p-b-20" style="width: 600px;">
				<view class="f-14 c-7" style="width: 110px;">
					关联uid
				</view>
				<uni-easyinput v-model="find.uid" placeholder="" disabled="disabled">
				</uni-easyinput>
			</view>
			<view class="banmi_flex a-c  p-b-20" style="width: 600px;">
				<view class="f-14 c-7" style="width: 110px;">
					商户名称
				</view>
				<uni-easyinput v-model="find.shop_name" placeholder="商户名称">
				</uni-easyinput>
			</view>
			<view class="banmi_flex a-c  p-b-20" style="width: 600px;">
				<view class="f-14 c-7" style="width: 110px;">
					商户电话
				</view>
				<uni-easyinput v-model="find.shop_tel" placeholder="商户电话">
				</uni-easyinput>
			</view>
			<view class="banmi_flex a-c  p-b-20" style="width: 600px;">
				<view class="f-14 c-7" style="width: 110px;">
					商户标签
				</view>
				<uni-easyinput v-model="find.shop_tag" placeholder="标签">
				</uni-easyinput>
			</view>
			<view class="banmi_flex a-c  p-b-20" style="width: 600px;">
				<view class="f-14 c-7" style="width: 110px;">
					营业时间
				</view>
				<uni-easyinput v-model="find.business_time" placeholder="营业时间">
				</uni-easyinput>
			</view>
			<view class="banmi_flex a-c  p-b-20" style="width: 600px;">
				<view class="f-14 c-7" style="width: 110px;">
					入驻时间
				</view>
				<view class="date" @longpress="longPressHandler(i)">
					<uni-datetime-picker type="datetime" :value="find.creation_time" v-model="find.creation_time"
						@maskClick="maskClick" @change="maskClick" />
				</view>
			</view>
			<view class="banmi_flex a-c  p-b-20" style="width: 600px;">
				<view class="f-14 c-7" style="width: 110px;">
					商家地址坐标
				</view>
				<view class="banmi_input_val banmi_flex">
					<view class="" style="flex:1">
						<uni-easyinput v-model="find.shop_addr" placeholder="请选择">
						</uni-easyinput>
					</view>
					<view class="m-l-10">
						<button class="cff" size="mini" type="primary" @click="on_dingwen()">选择位置</button>
					</view>
				</view>
			</view>
			<view class="banmi_flex a-c  p-b-20" style="width: 600px;">
				<view class="f-14 c-7" style="width: 110px;">
					lng
				</view>
				<view class="date">
					<uni-easyinput v-model="find.shop_lng" disabled="disabled">
					</uni-easyinput>
				</view>
			</view>
			<view class="banmi_flex a-c  p-b-20" style="width: 600px;">
				<view class="f-14 c-7" style="width: 110px;">
					lat
				</view>
				<view class="date">
					<uni-easyinput v-model="find.shop_lat" disabled="disabled">
					</uni-easyinput>
				</view>
			</view>
			<view class="banmi_flex a-c  p-b-20" style="width: 600px;">
				<view class="f-14 c-7" style="width: 110px;">
					商铺图片
				</view>
				<view class="banmi_input_val">
					<upImg ref="upimg" :val='1' name="图片" :count="1" :list="find.shop_img" t_type="images"
						@confirm="confirm_shop_img">
					</upImg>
				</view>
			</view>
			<view class="  p2" style="margin-left: 380px;">
				<button class=" " @click="on_users_cx()" type="primary" style="width: 200px;" size="mini">保存</button>
			</view>
			<upMapQq v-if="is_map" @close="is_map=false" class="banmi_input_val flex a-c" :banmi_key="tx_map_key"
				@confirm="confirm_mapqq">
			</upMapQq>
		</uni-popup-input>
	</view>
</template>

<script>
	export default {
		components: {

		},
		props: {
			id: {
				type: Number,
				default: 0
			},
		},
		data() {
			return {
				find: {},
				isShow: false,
				is_map: false,
				list: [],
				total: 0,
				page: 1,
				tx_map_key: '',
				is_top_height: false,
				is_init: false,
			}
		},
		mounted() {
			this.init();
			this.init_tx_map_key();
		},
		methods: {
			confirm_mapqq(e){
				this.find.shop_addr = e.poiaddress;
				this.find.shop_lat = e.lat;
				this.find.shop_lng = e.lng;
				this.is_map=false
			 
			},
			init_tx_map_key() {
				var that = this;
				let requestParams = {};
				this.Http.post('banmitongcheng/admin/Settings/index', requestParams).then(ret => {
					var find = ret.data.set_find;
					this.tx_map_key = find.tx_map_key;
			
				})
			},
			on_dingwen() {
				let that = this;
				this.is_map = true;
				 
			},

			confirm_shop_img(vals) {
				if (vals.length == 0) {
					this.find.shop_img = ''
					return
				}
				this.find.shop_img = vals[0]['attachment']
			},

			maskClick(val) {

				this.find.creation_time = val;
			},
			on_users_cx(index) {
				var that = this;


				let requestParams = that.find;
				this.Http.post('banmitongcheng/admin/Shoplist/updates_bjsjxx', requestParams).then(ret => {
					uni.showToast({
						title: ret.msg,
						icon: 'none'
					})
					if (ret.status == 200) {
						this.$emit("confirm");

					}
				})
			},
			init() {
				var that = this;

				var id = that.id;
				let requestParams = {
					id: id,
				};
				this.Http.post('banmitongcheng/admin/Shoplist/finds_cxsjxq', requestParams).then(ret => {
					if (ret.status == 200) {

						this.find = ret.data.find;
						if (!this.find.vip_end_time) {
							this.find.vip_end_time = 0;
						}

						this.is_init = true;
					}
				})
			},
			on_close() {

				this.is_init = false;
				this.$emit("close");
			},


		}
	}
</script>

<style>
	button::after {
		border: none;
	}

	.top_head {
		background-color: #F8F8F8;
		width: 100%;
		top: 0;
		left: 0;
		z-index: 999;
		position: sticky
	}

	.but {
		width: 120rpx;
		height: 100rpx;
		padding: 0;
		border: 0;
		background-color: transparent;
		outline: none;
	}
</style>